package com.tianya.portal.blog.controller;

import com.tianya.common.web.core.domain.AjaxResult;
import com.tianya.common.web.core.page.TableDataInfo;
import com.tianya.portal.blog.domain.BlogBookRecall;
import com.tianya.portal.blog.service.IBlogBookRecallService;
import com.tianya.portal.common.core.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 文学记录 信息操作处理
 *
 * @author tianya
 * @date 2024-06-10
 */
@RestController
@RequestMapping("/bookRecall")
public class BlogBookRecallController extends BaseController {

    @Autowired
    private IBlogBookRecallService blogBookRecallService;

    /**
     * 查询文学记录列表
     */
    @GetMapping("/list")
    @ResponseBody
    public TableDataInfo list(BlogBookRecall blogBookRecall) {
        startPage();
        List<BlogBookRecall> list = blogBookRecallService.selectBlogBookRecallList(blogBookRecall);
        return getDataTable(list);
    }

    /**
     * 查询文学记录数据
     */
    @GetMapping("/listData")
    @ResponseBody
    public AjaxResult listData(BlogBookRecall blogBookRecall) {
        List<BlogBookRecall> list = blogBookRecallService.selectBlogBookRecallList(blogBookRecall);
        return success(list);
    }


    /**
     * 获取文学记录详细信息
     */
    @GetMapping(value = "/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(blogBookRecallService.selectBlogBookRecallById(id));
    }
}
